package super

import (
	"Project/global"
	"Project/model/common/request"
	"Project/model/common/response"
	resp "Project/model/drugs/response"
	"github.com/gin-gonic/gin"
	"go.uber.org/zap"
)

type DrugRecordApi struct {
}

// 获取药店所有的药品记录
func (d *DrugRecordApi) GetDrugRecordList(c *gin.Context) {
	// 获取查询条件，分页信息
	var req request.ConditionAndPageInfo
	err := c.ShouldBindJSON(&req)
	global.GVA_LOG.Debug("req", zap.Any("req", req))
	if err != nil {
		global.GVA_LOG.Error("bind err", zap.Error(err))
		response.FailWithMessage("参数错误", c)
		return
	}

	//查询
	list, total, err := drugRecordService.GetRecordList(&req)
	if err != nil {
		response.Fail(c)
		return
	}
	// 返回
	response.OkWithData(resp.InquireResponse{RecordList: list, Total: total}, c)
}
